﻿@page
@{ Layout = "_Layout"; }

<template v-if="pageType === 'columns'">

  <el-form v-on:submit.native.prevent label-width="150px" size="mini">
    <el-form-item label="表名称">
      {{ tableName }}
    </el-form-item>
    <el-form-item label="关联的站点">
      <el-tag size="small" style="margin-right: 5px;" v-for="siteName in nameDict[tableName]">
        {{ siteName }}
      </el-tag>
    </el-form-item>
    <el-form-item label="内容数">
      {{ count.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") }}
    </el-form-item>
  </el-form>

  <el-alert type="warning">
    可以直接在数据库管理工具中修改表 {{ tableName }} 的字段，修改字段后需要
    <el-link :underline="false" type="primary" v-on:click="btnRemoveCacheClick" href="javascript:;">
      清除缓存
    </el-link>
    才能体现在系统内容表中
  </el-alert>

  <div style="height: 10px"></div>

  <el-table
    :data="columns"
    size="small"
    style="width: 100%">
    <el-table-column label="字段名称">
      <template slot-scope="scope">
        {{ scope.row.attributeName }}
      </template>
    </el-table-column>
    <el-table-column label="字段类型">
      <template slot-scope="scope">
        {{ scope.row.dataType + (scope.row.dataType === 'VarChar' ? '(' + scope.row.dataLength + ')' : '') }}
      </template>
    </el-table-column>
  </el-table>

  <el-divider></el-divider>
  <div style="height: 10px"></div>

  <el-button size="small" v-on:click="btnCancelClick">返 回</el-button>

</template>
<template v-else>

  <el-table
    :data="tableNames"
    size="small"
    style="width: 100%">
    <el-table-column label="表名称">
      <template slot-scope="scope">
        <el-link :underline="false" type="primary" v-on:click="btnColumnsClick(scope.row)">{{ scope.row }}</el-link>
      </template>
    </el-table-column>
    <el-table-column label="关联的站点">
      <template slot-scope="scope">
        <el-tag size="small" style="margin-right: 5px;" v-for="siteName in nameDict[scope.row]">
          {{ siteName }}
        </el-tag>
      </template>
    </el-table-column>
  </el-table>

</template>

@section Scripts{
<script src="/sitefiles/assets/js/admin/settings/sitesTables.js" type="text/javascript"></script> }